
import threading  # 导入多线程模块
import time

def say_hello():
    for x in range(10):
        print("hello!!!")
        time.sleep(1)

def say_world():
    for y in range(10):
        print('world!!!')
        time.sleep(1)

if __name__ == '__main__':
    # 用多线程来并行
    # 1. 创建一个线程，绑定 say_hello 函数
    t1 = threading.Thread(target=say_hello)
    t1.start()  # 启动 t1 线程
    t2 = threading.Thread(target=say_world)
    t2.start()

    print("主线程运行结束")

    # 串行
    # say_hello()
    # say_world()
